package cn.edu.neusoft.myappos.Activity;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

import cn.edu.neusoft.myappos.Adapter.CourseAdapter;
import cn.edu.neusoft.myappos.Bean.CourseBean;
import cn.edu.neusoft.myappos.R;

public class Main1CourseActivity extends AppCompatActivity {
    private RecyclerView recyclerView;
    private RecyclerView.LayoutManager layoutManager;
    private CourseAdapter Adapter;
    List<CourseBean> list;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_course_activity);
        initRecyclerView();
    }

    private void initRecyclerView() {
        recyclerView =findViewById(R.id.course_rv);
        layoutManager=new LinearLayoutManager(this);
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setHasFixedSize(true);
        list=getData();
        Adapter=new CourseAdapter(this);
        recyclerView.setAdapter(Adapter);
        Adapter.setList(list);
    }


    public List<CourseBean> getData(){
        List<CourseBean>list=new ArrayList<CourseBean>();
        CourseBean courseBean;

        courseBean =new CourseBean();
        courseBean.setFood_id(1);
        courseBean.setFoodname("英语1");
        courseBean.setPic(R.drawable.f2);
        courseBean.setShopname("杰西");
        courseBean.setIntro("ABBC");
        courseBean.setPrice("199");
        courseBean.setTel("1999");
        list.add(courseBean);

        courseBean =new CourseBean();
        courseBean.setFood_id(5);
        courseBean.setFoodname("西班牙语");
        courseBean.setPic(R.drawable.f2);
        courseBean.setShopname("王晓亮");
        courseBean.setIntro("ABBC");
        courseBean.setPrice("199");
        courseBean.setTel("1921");
        list.add(courseBean);


        courseBean =new CourseBean();
        courseBean.setFood_id(6);
        courseBean.setFoodname("法语");
        courseBean.setPic(R.drawable.f2);
        courseBean.setShopname("张金涛");
        courseBean.setIntro("ABBC");
        courseBean.setPrice("199");
        courseBean.setTel("1949");
        list.add(courseBean);

        courseBean =new CourseBean();
        courseBean.setFood_id(7);
        courseBean.setFoodname("德语");
        courseBean.setPic(R.drawable.f2);
        courseBean.setShopname("赫拉");
        courseBean.setIntro("ABBC");
        courseBean.setPrice("199");
        courseBean.setTel("100");
        list.add(courseBean);


        return list;
    }
}

